package com.zygh.sendmail.module.task;

import com.zygh.sendmail.module.service.JavaMailService;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * 每天早上07：30巡检一次
 * 下午18：00巡检一次
 */
@Component
public class SendMail {
    @Resource
    private JavaMailService javaMailService;

    //@Scheduled(cron = "0/10 * *  * * ? ") 每十秒
    @Scheduled(cron = "0 33 07 * * ?")
    public void sendMail() throws Exception {
        javaMailService.sendAttachmentMail();
    }

    @Scheduled(cron = "0 0 18 * * ?")
    public void sendMail1() throws Exception {
        javaMailService.sendAttachmentMail();
    }

//    @Scheduled(cron = "0/10 * *  * * ? ")
//    public void sendAttachmentMail() throws Exception {
//        javaMailService.sendAttachmentMail();
//    }
}
